/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Server.DTO;

import Server.BUS.StringUlti;

/**
 *
 * @author Trung
 */
public class InsertQuery extends Query {
    private String tableName;
    private String valuesString;
    
    public InsertQuery()
    {
        tableName = "";
        valuesString = "";
    }
    
    public InsertQuery(String _queryString)
    {
        this.keyWord = "INSERT";
        this.queryString = StringUlti.formatString(_queryString);
        
        int begin = this.queryString.indexOf("INSERT INTO") + "INSERT INTO".length();
        int end = this.queryString.indexOf("VALUES") - 1;
        
        this.tableName = this.queryString.substring(begin, end);
        this.tableName = this.tableName.trim();
        
        begin = this.queryString.indexOf("VALUES") + "VALUES".length();
        this.valuesString = this.queryString.substring(begin);
        this.valuesString = this.valuesString.trim();
    }

    /**
     * @return the tableName
     */
    public String getTableName() {
        return tableName;
    }

    /**
     * @param tableName the tableName to set
     */
    public void setTableName(String tableName) {
        this.tableName = tableName;
        this.tableName = StringUlti.formatString(this.tableName);
    }

    /**
     * @return the valuesString
     */
    public String getValuesString() {
        return valuesString;
    }

    /**
     * @param valuesString the valuesString to set
     */
    public void setValuesString(String valuesString) {
        this.valuesString = valuesString;
        this.valuesString = StringUlti.formatString(this.valuesString);
    }
}
